// 管理所有API接口 (接口)

import mockRequest from "./mockAjax.js"; 
import request from "./request.js";
// http://xpya.top/api/product/getBaseCategoryList

// 商品名称
export const requestCategoryList = () => {
  return request({
    url: "/product/getBaseCategoryList",
    method: "get",
  });
};
// 商品归类
export const requestSearchInfo = (data) => {  
  return request({
    url: "/list",
    method: "post",
    data: data,
  });
};
// 商品详情
export const requestGoodsInfo = (skuId) => {  
  return request({
    url: `/item/${skuId}`,
    method: "get",    
  });
};
// 商品购买信息
export const reqAddOrUpdateShopCart = (skuId, skuNum) => {  
  return request({
    url: `cart/addToCart/${skuId}/${skuNum}`,
    method: "post",
  });
}
// 获取添加购物车的信息
export const reqCartList = () => {  
  return request({
    url: `cart/cartList`,
    method: "get",
  });
}
// 删除商品信息
export const reqDeleteCartById = (skuId) => {
  return request({
    url: `cart/deleteCart/${skuId}`,
    method: "delete",
  });
}
// 选中状态
export const reqUpdateCheckedById = (skuId, isCheckef) => {  
  return request({
    url: `cart/checkCart/${skuId}/${isCheckef}`,
    method: "get",
  });
}
// 获取验证码接口
export const reqGetCode = (phone) => {
  return request({
    url: `user/passport/sendCode/${phone}`,
    method: "get",
  });
}
// 提交用户注册
export const reqUserRegister = (data) => {
  return request({
    url: `user/passport/register`,
    data:data,
    method: "post",
  });
}
// 获取唯一表示
export const reqUserLogin = (data) => {
  return request({
    url: `/user/passport/login`,
    data:data,
    method: "post",
  });
}
// 确定用户登录
export const reqUserInfo = () => {
  return request({
    url: `user/passport/auth/getUserInfo`,
    method: "get",
  });
}
// 退出用户登录
export const reqLogout = () => {
  return request({
    url: "user/passport/logout",
    method: "get",
  })
}

// mock
export const requestBannerList = () => {
  return mockRequest({
    url: "/banner",
    method: "get",
  });
};
export const requestFloorList = () => {
  return mockRequest({
    url: "/floor",
    method: "get",
  });
};